export function ajax(url) {
    return new Promise(function (resolve, reject) {
        const xhr = new XMLHttpRequest();
        xhr.open('GET', url)
        xhr.onload = function () {
            resolve(JSON.parse(xhr.responseText));
        }
        xhr.onerror = function () {
            reject(xhr.responseText);
        }
        xhr.send(null)
    })
}